"use strict";
import * as Util from "../Util";
import defaultEdgeOption from "../Options/edge";
import {Status} from "../Util/constant";

class Edge {
    constructor(body, operator, data, globalOptions, options) {
        this.id = data.id;
        this.body = body;
        this.label = data.label;
        this.options = {};
        this.strength = 0.2;
        this.type = data.type;
        this.operator = operator;
        this.globalOptions = globalOptions; // 接收全局变量
        this.source = data.source; // 源节点
        this.target = data.target; // 目标节点
        this.status = data.status || Status.default; // 默认效果
        this.setOptions(options);
    }

    /**
     * 设置参数
     * @param {Object} options
     */
    setOptions(options) {
        this.options = Util.deepExtend(defaultEdgeOption, options);
    }


}

export default Edge;
